package org.molamil.acto.types {
	import org.molamil.acto.core.parsers.ParserError;	

	/**
	 * <code>AbstractTypeParser</code> that returns a <code>String</code> representation 
	 * of the passed value. In reality, this is an shallow class implementation using 
	 * the base implementation from <code>AbstractTypeParser</code> that returns the 
	 * passed value when calling parse() - just adding check for null.
	 * 
	 * @author Jorge Hernandez
	 * @see org.molamil.acto.types.AbstractTypeParser
	 */
	public class StringTypeParser extends AbstractTypeParser {
		
		
		// CONSTANTS
		
		/**
		 * @inheritDoc
		 */
		public static const PRIORITY:uint = 900;
		
		/**
		 * @inheritDoc
		 */
		public static const TYPE:Class = String;
		
		
		// PROTECTED METHODS
		
		/**
		 * Returns a copy of the value passed.
		 * 
		 * @param value <code>String</code> value to test
		 * @return A copy of the value passed.
		 * @throws org.molamil.acto.core.errors.ParserError The value is null
		 */
		override protected function doParse(value:String):* {
			
			if (value == null)
				throw new ParserError("ERROR: value is null and cannot be parsed " +
					"into a String");

			return super.doParse(value);
			
		}
		
		
	}
	
}
